package org.example.demowebsrocket.model;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 *
 *
 * @author zhaokf
 * @date 13:06 2025/8/17
 */
@NoArgsConstructor
@Data
public class Message {


    // 消息类型：JOIN(加入群组), LEAVE(离开群组), GROUP_MSG(群组消息), SYSTEM(系统消息)
    private String type;

    // 发送者用户名
    private String sender;

    // 目标群组
    private String targetUsername;

    // 消息内容
    private String content;

    // 消息时间戳
    private LocalDateTime timestamp = LocalDateTime.now();
    public Message(String type, String sender, String targetUsername, String content){
        this.type = type;
        this.sender = sender;
        this.targetUsername = targetUsername;
        this.content = content;
        this.timestamp = LocalDateTime.now();
    }
}
